define([], function () {
    return function (json, options) {
        var PADDING = "    ";
        var format = function (obj, level) {
            if (!level) {
                level = 1;
            }
            if (angular.isArray(obj)) {
                var result = "[";
                for (var i = 0; i < obj.length; i++) {
                    result += format(obj[i], level) + ","
                }
                if (result.length != 1) {
                    result = result.substr(0, result.length - 1);
                }
                
                result += "]";
                return result;
            } else if (angular.isObject(obj)) {
                var result = "{\r\n";
                var padding = "";
                var i = 0;
                while (i < level) {
                    padding += PADDING;
                    i++;
                }
                for (key in obj) {
                    var value = obj[key];
                    if (obj.hasOwnProperty(key)) {
                        result += padding + "\"" + key + "\"" + " : " + format(value, level + 1) + ",\r\n";
                    }
                }
                if (result.length!=3) {
                    result = result.substr(0, result.length - 3);
                }
                
                i = 0;
                padding = "";
                while (i < level - 1) {
                    padding += PADDING;
                    i++;
                }
                result += "\r\n" + padding + "}";
                return result;
            } else if (angular.isNumber(obj)) {
                return obj;
            } else if(_.isBoolean(obj)){
                return obj;
            }else if (obj == null){
                return null
            }else{
                return "\"" + obj + "\"";
            }
        }
        return format(json);
    };

});